#include "Packet.h"
#include "Globals.h"


void EncodePosDir(int srcx, int srcy, int srcdir, BYTE* result)
{
	///  [    BYTE0    ] [    BYTE1    ] [    BYTE2    ] 
	///  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 
	/// +-------------------+-------------------+-------+
	/// |       srcx        |       srcy        |  dir  |
	/// +-------------------+-------------------+-------+
	result[0] =                        ((srcx >> 2) & 0xFF);
	result[1] = ((srcx << 6) & 0xC0) | ((srcy >> 4) & 0x3F);
	result[2] = ((srcy << 4) & 0xF0) | ((srcdir >> 0) & 0x0F);
}


void DecodePosDir(const unsigned char* packet, int& x, int& y, int& dir)
{
	x = ((packet[0] & 0xFF) << 2) | ((packet[1] & 0xC0) >> 6); // 10 bits
	y = ((packet[1] & 0x3F) << 4) | ((packet[2] & 0xF0) >> 4); // 10 bits
	dir = ((packet[2] & 0x0F) >> 0);                           //  4 bits
}


void EncodeSrcDst(int srcx, int srcy, int dstx, int dsty, int xcellpos, int ycellpos, BYTE* result)
{
	///  [    BYTE0    ] [    BYTE1    ] [    BYTE2    ] [    BYTE3    ] [    BYTE4    ] [    BYTE5    ]
	///  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 
	/// +-------------------+-------------------+-------------------+-------------------+-------+-------+
	/// |       srcx        |       srcy        |       dstx        |       dsty        | xcell | ycell |
	/// +-------------------+-------------------+-------------------+-------------------+-------+-------+
	result[0] =                        ((srcx >> 2) & 0xFF);
	result[1] = ((srcx << 6) & 0xC0) | ((srcy >> 4) & 0x3F);
	result[2] = ((srcy << 4) & 0xF0) | ((dstx >> 6) & 0x0F);
	result[3] = ((dstx << 2) & 0xFC) | ((dsty >> 8) & 0x03);
	result[4] = ((dsty << 0) & 0xFF)                       ;
	result[5] = ((xcellpos << 4) & 0xF0) | ((ycellpos >> 0) & 0x0F);
}


void DecodeSrcDst(const unsigned char* packet, int& rsx, int& rsy, int& rdx, int& rdy, int& xcellpos, int& ycellpos)
{
	rsx = ((packet[0] & 0xFF) << 2) | ((packet[1] & 0xC0) >> 6); // 10 bits
	rsy = ((packet[1] & 0x3F) << 4) | ((packet[2] & 0xF0) >> 4); // 10 bits
	rdx = ((packet[2] & 0x0F) << 6) | ((packet[3] & 0xFC) >> 2); // 10 bits
	rdy = ((packet[3] & 0x03) << 8) | ((packet[4] & 0xFF) >> 0); // 10 bits
	xcellpos = ((packet[5] & 0xF0) >> 4);                        //  4 bits
	ycellpos = ((packet[5] & 0x0F) >> 0);                        //  4 bits
}


bool IsFixedPacket(int packetType)
{
	return ( g_packetLenMap[packetType] != -1 );
}


int GetPacketSize(int packetType)
{
	if( packetType == HEADER_ZC_SRPACKETR2_INIT )
		return sizeof(PACKET_ZC_SRPACKETR2_INIT);

	if( packetType == HEADER_CZ_SRPACKETR2_START )
		return sizeof(PACKET_CZ_SRPACKETR2_START);

	return max(2, g_packetLenMap[packetType]);
}


void InitPacketLenWithClient()
{
	#define REGN(id,len,H,T) { g_packetLenMap[id] = len; C_ASSERT( id == H ); C_ASSERT( len == sizeof(T) ); }
	#define REGV(id,len,H,T) { g_packetLenMap[id] =  -1; C_ASSERT( id == H ); C_ASSERT( len == sizeof(T) ); }

	g_packetLenMap[100] = 55;
	g_packetLenMap[101] = 17;
	g_packetLenMap[102] = 3;
	g_packetLenMap[103] = 37;
	g_packetLenMap[104] = 46;
	g_packetLenMap[105] = -1;
	g_packetLenMap[106] = 23;
	g_packetLenMap[107] = -1;
	g_packetLenMap[108] = 3;
	g_packetLenMap[109] = 114;
	g_packetLenMap[110] = 3;
	g_packetLenMap[111] = 2;
	g_packetLenMap[112] = 3;
	g_packetLenMap[113] = 28;
	g_packetLenMap[114] = 22;
	REGN(115, 11, HEADER_ZC_ACCEPT_ENTER, PACKET_ZC_ACCEPT_ENTER);
	g_packetLenMap[116] = 3;
	g_packetLenMap[117] = -1;
	g_packetLenMap[118] = 9;
	g_packetLenMap[119] = 5;
	REGN(120, 55, HEADER_ZC_NOTIFY_STANDENTRY, PACKET_ZC_NOTIFY_STANDENTRY);
	g_packetLenMap[121] = 53;
	REGN(122, 58, HEADER_ZC_NOTIFY_ACTENTRY, PACKET_ZC_NOTIFY_ACTENTRY);
	g_packetLenMap[123] = 60;
	g_packetLenMap[124] = 44;
	g_packetLenMap[125] = 2;
	g_packetLenMap[126] = 105;
	g_packetLenMap[127] = 6;
	g_packetLenMap[128] = 7;
	g_packetLenMap[129] = 3;
	g_packetLenMap[130] = 2;
	REGN(131, 2, HEADER_ZC_ACCEPT_QUIT, PACKET_ZC_ACCEPT_QUIT);
	REGN(132, 2, HEADER_ZC_REFUSE_QUIT, PACKET_ZC_REFUSE_QUIT);
	g_packetLenMap[133] = 10;
	REGN(134, 16, HEADER_ZC_NOTIFY_MOVE, PACKET_ZC_NOTIFY_MOVE);
	REGN(135, 12, HEADER_ZC_NOTIFY_PLAYERMOVE, PACKET_ZC_NOTIFY_PLAYERMOVE);
	g_packetLenMap[136] = 10;
	g_packetLenMap[137] = 11;
	REGN(138, 29, HEADER_ZC_NOTIFY_ACT, PACKET_ZC_NOTIFY_ACT);
	g_packetLenMap[139] = 23;
	g_packetLenMap[140] = 14;
	g_packetLenMap[141] = -1;
	g_packetLenMap[142] = -1;
//	REGN(143, 6, HEADER_SC_ENTRY_ACK, PACKET_ENTRY_ACK);
	g_packetLenMap[144] = 7;
	g_packetLenMap[145] = 22;
	g_packetLenMap[146] = 28;
	g_packetLenMap[147] = 2;
	g_packetLenMap[148] = 19;
	g_packetLenMap[149] = 30;
	g_packetLenMap[150] = -1;
	g_packetLenMap[151] = -1;
	g_packetLenMap[152] = 3;
	g_packetLenMap[153] = -1;
	REGV(154, 4, HEADER_ZC_BROADCAST, PACKET_ZC_BROADCAST);
	g_packetLenMap[155] = 34;
	g_packetLenMap[156] = 9;
	g_packetLenMap[157] = 17;
	g_packetLenMap[158] = 17;
	g_packetLenMap[159] = 20;
	g_packetLenMap[160] = 23;
	g_packetLenMap[161] = 6;
	g_packetLenMap[162] = 14;
	g_packetLenMap[163] = -1;
	g_packetLenMap[164] = -1;
	g_packetLenMap[165] = -1;
	g_packetLenMap[166] = -1;
	g_packetLenMap[167] = 9;
	g_packetLenMap[168] = 7;
	g_packetLenMap[169] = 6;
	g_packetLenMap[170] = 7;
	g_packetLenMap[171] = 4;
	g_packetLenMap[172] = 7;
//	REGN(173, 4, HEADER_CZ_REQ_ITEM_EXPLANATION_BYNAME, PACKET_CZ_REQ_ITEM_EXPLANATION_BYNAME);
	g_packetLenMap[174] = -1;
	g_packetLenMap[175] = 6;
	g_packetLenMap[176] = 8;
	g_packetLenMap[177] = 8;
	g_packetLenMap[178] = 3;
	g_packetLenMap[179] = 3;
	g_packetLenMap[180] = -1;
	g_packetLenMap[181] = 6;
	g_packetLenMap[182] = 6;
	g_packetLenMap[183] = -1;
	g_packetLenMap[184] = 7;
	g_packetLenMap[185] = 6;
	g_packetLenMap[186] = 2;
	g_packetLenMap[187] = 5;
	g_packetLenMap[188] = 6;
	g_packetLenMap[189] = 44;
	g_packetLenMap[190] = 5;
	g_packetLenMap[191] = 3;
	g_packetLenMap[192] = 7;
	g_packetLenMap[193] = 2;
	g_packetLenMap[194] = 6;
	g_packetLenMap[195] = 8;
	g_packetLenMap[196] = 6;
	g_packetLenMap[197] = 7;
	g_packetLenMap[198] = -1;
	g_packetLenMap[199] = -1;
	g_packetLenMap[200] = -1;
	g_packetLenMap[201] = -1;
	g_packetLenMap[202] = 3;
	g_packetLenMap[203] = 3;
	g_packetLenMap[204] = 6;
	g_packetLenMap[205] = 3;
	g_packetLenMap[206] = 2;
	g_packetLenMap[207] = 27;
	g_packetLenMap[208] = 3;
	g_packetLenMap[209] = 4;
	g_packetLenMap[210] = 4;
	g_packetLenMap[211] = 2;
	g_packetLenMap[212] = -1;
	g_packetLenMap[213] = -1;
	g_packetLenMap[214] = 3;
	g_packetLenMap[215] = -1;
	g_packetLenMap[216] = 6;
	g_packetLenMap[217] = 14;
	g_packetLenMap[218] = 3;
	g_packetLenMap[219] = -1;
	g_packetLenMap[220] = 28;
	g_packetLenMap[221] = 29;
	g_packetLenMap[222] = -1;
	g_packetLenMap[223] = -1;
	g_packetLenMap[224] = 30;
	g_packetLenMap[225] = 30;
	g_packetLenMap[226] = 26;
	g_packetLenMap[227] = 2;
	g_packetLenMap[228] = 6;
	g_packetLenMap[229] = 26;
	g_packetLenMap[230] = 3;
	g_packetLenMap[231] = 3;
	g_packetLenMap[232] = 8;
	g_packetLenMap[233] = 19;
	g_packetLenMap[234] = 5;
	g_packetLenMap[235] = 2;
	g_packetLenMap[236] = 3;
	g_packetLenMap[237] = 2;
	g_packetLenMap[238] = 2;
	g_packetLenMap[239] = 2;
	g_packetLenMap[240] = 3;
	g_packetLenMap[241] = 2;
	g_packetLenMap[242] = 6;
	g_packetLenMap[243] = -1;
	REGN(244, 21, HEADER_ZC_ADD_ITEM_TO_STORE, PACKET_ZC_ADD_ITEM_TO_STORE);
	g_packetLenMap[245] = 11;
	g_packetLenMap[246] = 8;
	g_packetLenMap[247] = 17;
	g_packetLenMap[248] = 2;
	g_packetLenMap[249] = 26;
	g_packetLenMap[250] = 3;
	g_packetLenMap[251] = -1;
	g_packetLenMap[252] = 6;
	g_packetLenMap[253] = 27;
	g_packetLenMap[254] = 30;
	g_packetLenMap[255] = 10;
	g_packetLenMap[256] = 2;
	g_packetLenMap[257] = 6;
	g_packetLenMap[258] = 6;
	g_packetLenMap[259] = 30;
	g_packetLenMap[260] = 79;
	g_packetLenMap[261] = 31;
	g_packetLenMap[262] = 10;
	g_packetLenMap[263] = 10;
	g_packetLenMap[264] = -1;
	g_packetLenMap[265] = -1;
	g_packetLenMap[266] = 4;
	g_packetLenMap[267] = 6;
	g_packetLenMap[268] = 6;
	g_packetLenMap[269] = 2;
	g_packetLenMap[270] = 11;
	g_packetLenMap[271] = -1;
	g_packetLenMap[272] = 10;
	g_packetLenMap[273] = 39;
	g_packetLenMap[274] = 4;
	g_packetLenMap[275] = 25;
	g_packetLenMap[276] = 31;
	g_packetLenMap[277] = 35;
	g_packetLenMap[278] = 17;
	g_packetLenMap[279] = 18;
	g_packetLenMap[280] = 2;
	g_packetLenMap[281] = 13;
	g_packetLenMap[282] = 15;
	g_packetLenMap[283] = 20;
	g_packetLenMap[284] = 68;
	g_packetLenMap[285] = 2;
	g_packetLenMap[286] = 3;
	g_packetLenMap[287] = 16;
	g_packetLenMap[288] = 6;
	g_packetLenMap[289] = 14;
	g_packetLenMap[290] = -1;
	g_packetLenMap[291] = -1;
	g_packetLenMap[292] = 21;
	g_packetLenMap[293] = 8;
	g_packetLenMap[294] = 8;
	g_packetLenMap[295] = 8;
	g_packetLenMap[296] = 8;
	g_packetLenMap[297] = 8;
	g_packetLenMap[298] = 2;
	g_packetLenMap[299] = 2;
	g_packetLenMap[300] = 3;
	g_packetLenMap[301] = 4;
	g_packetLenMap[302] = 2;
	g_packetLenMap[303] = -1;
	g_packetLenMap[304] = 6;
	g_packetLenMap[305] = 86;
	g_packetLenMap[306] = 6;
	g_packetLenMap[307] = -1;
	g_packetLenMap[308] = -1;
	g_packetLenMap[309] = 7;
	g_packetLenMap[310] = -1;
	g_packetLenMap[311] = 6;
	g_packetLenMap[312] = 3;
	g_packetLenMap[313] = 16;
	g_packetLenMap[314] = 4;
	g_packetLenMap[315] = 4;
	g_packetLenMap[316] = 4;
	g_packetLenMap[317] = 6;
	g_packetLenMap[318] = 24;
	g_packetLenMap[319] = 26;
	g_packetLenMap[320] = 22;
	g_packetLenMap[321] = 14;
	g_packetLenMap[322] = 6;
	g_packetLenMap[323] = 10;
	g_packetLenMap[324] = 23;
	g_packetLenMap[325] = 19;
	g_packetLenMap[326] = 6;
	g_packetLenMap[327] = 39;
	g_packetLenMap[328] = 8;
	g_packetLenMap[329] = 9;
	g_packetLenMap[330] = 6;
	g_packetLenMap[331] = 27;
	g_packetLenMap[332] = -1;
	g_packetLenMap[333] = 2;
	g_packetLenMap[334] = 6;
	g_packetLenMap[335] = 6;
	g_packetLenMap[336] = 110;
	g_packetLenMap[337] = 6;
	g_packetLenMap[338] = -1;
	g_packetLenMap[339] = -1;
	g_packetLenMap[340] = -1;
	g_packetLenMap[341] = -1;
	g_packetLenMap[342] = -1;
	g_packetLenMap[343] = 6;
	g_packetLenMap[344] = -1;
	g_packetLenMap[345] = 54;
	g_packetLenMap[346] = 66;
	g_packetLenMap[347] = 54;
	g_packetLenMap[348] = 90;
	g_packetLenMap[349] = 42;
	g_packetLenMap[350] = 6;
	g_packetLenMap[351] = 42;
	g_packetLenMap[352] = -1;
	g_packetLenMap[353] = -1;
	g_packetLenMap[354] = -1;
	g_packetLenMap[355] = -1;
	g_packetLenMap[356] = -1;
	g_packetLenMap[357] = 30;
	g_packetLenMap[358] = -1;
	g_packetLenMap[359] = 3;
	g_packetLenMap[360] = 14;
	g_packetLenMap[361] = 3;
	g_packetLenMap[362] = 30;
	g_packetLenMap[363] = 10;
	g_packetLenMap[364] = 43;
	g_packetLenMap[365] = 14;
	g_packetLenMap[366] = 186;
	g_packetLenMap[367] = 182;
	g_packetLenMap[368] = 14;
	g_packetLenMap[369] = 30;
	g_packetLenMap[370] = 10;
	g_packetLenMap[371] = 3;
	g_packetLenMap[372] = -1;
	g_packetLenMap[373] = 6;
	g_packetLenMap[374] = 106;
	g_packetLenMap[375] = -1;
	g_packetLenMap[376] = 4;
	g_packetLenMap[377] = 5;
	g_packetLenMap[378] = 4;
	g_packetLenMap[379] = -1;
	g_packetLenMap[380] = 6;
	g_packetLenMap[381] = 7;
	g_packetLenMap[382] = -1;
	g_packetLenMap[383] = -1;
	g_packetLenMap[384] = 6;
	g_packetLenMap[385] = 3;
	g_packetLenMap[386] = 106;
	g_packetLenMap[387] = 10;
	g_packetLenMap[388] = 10;
	g_packetLenMap[389] = 34;
//	REGN(390, 6, HEADER_COLLECTORDEAD, PACKET_COLLECTORDEAD);
	g_packetLenMap[391] = 6;
	g_packetLenMap[392] = 8;
	g_packetLenMap[393] = 4;
	g_packetLenMap[394] = 4;
	g_packetLenMap[395] = 4;
	g_packetLenMap[396] = 29;
	g_packetLenMap[397] = -1;
	g_packetLenMap[398] = 10;
	g_packetLenMap[399] = 6;
	g_packetLenMap[400] = 23;
	g_packetLenMap[401] = 86;
	g_packetLenMap[402] = 24;
	g_packetLenMap[403] = 2;
	g_packetLenMap[404] = 30;
	g_packetLenMap[405] = 102;
	g_packetLenMap[406] = 9;
	g_packetLenMap[407] = 4;
	g_packetLenMap[408] = 8;
	g_packetLenMap[409] = 4;
	g_packetLenMap[410] = 14;
	g_packetLenMap[411] = 10;
	g_packetLenMap[412] = -1;
	g_packetLenMap[413] = 6;
	g_packetLenMap[414] = 2;
	g_packetLenMap[415] = 6;
	g_packetLenMap[416] = 3;
	g_packetLenMap[417] = 3;
	g_packetLenMap[418] = 37;
	g_packetLenMap[419] = 5;
	g_packetLenMap[420] = 11;
	g_packetLenMap[421] = 26;
	g_packetLenMap[422] = -1;
	g_packetLenMap[423] = 4;
	g_packetLenMap[424] = 4;
	g_packetLenMap[425] = 6;
	g_packetLenMap[426] = 10;
	g_packetLenMap[427] = 12;
	g_packetLenMap[428] = 6;
	g_packetLenMap[429] = -1;
	g_packetLenMap[430] = 4;
	g_packetLenMap[431] = 4;
	g_packetLenMap[432] = 11;
	g_packetLenMap[433] = 7;
	g_packetLenMap[434] = -1;
	g_packetLenMap[435] = 67;
	g_packetLenMap[436] = 12;
	g_packetLenMap[437] = 18;
	g_packetLenMap[438] = 114;
	g_packetLenMap[439] = 6;
	g_packetLenMap[440] = 3;
	g_packetLenMap[441] = 6;
	g_packetLenMap[442] = 26;
	g_packetLenMap[443] = 26;
	g_packetLenMap[444] = 26;
	g_packetLenMap[445] = 26;
	g_packetLenMap[446] = 2;
	g_packetLenMap[447] = 3;
	g_packetLenMap[448] = 2;
	g_packetLenMap[449] = 14;
	g_packetLenMap[450] = 10;
	REGV(451, 16, HEADER_ZC_BROADCAST2, PACKET_ZC_BROADCAST2);
	g_packetLenMap[452] = 22;
	g_packetLenMap[453] = 22;
	g_packetLenMap[454] = 4;
	g_packetLenMap[455] = 2;
	g_packetLenMap[456] = 13;
	g_packetLenMap[457] = 97;
	g_packetLenMap[458] = 3;
	g_packetLenMap[459] = 9;
	g_packetLenMap[460] = 9;
	g_packetLenMap[461] = 30;
	g_packetLenMap[462] = 6;
	g_packetLenMap[463] = 28;
	g_packetLenMap[464] = 8;
	g_packetLenMap[465] = 14;
	g_packetLenMap[466] = 10;
	g_packetLenMap[467] = 35;
	g_packetLenMap[468] = 6;
	g_packetLenMap[469] = -1;
	g_packetLenMap[470] = 4;
	g_packetLenMap[471] = 11;
	g_packetLenMap[472] = 54;
	g_packetLenMap[473] = 53;
	g_packetLenMap[474] = 60;
	g_packetLenMap[475] = 2;
	g_packetLenMap[476] = -1;
	g_packetLenMap[477] = 47;
	g_packetLenMap[478] = 33;
	g_packetLenMap[479] = 6;
	g_packetLenMap[480] = 30;
	g_packetLenMap[481] = 8;
	g_packetLenMap[482] = 34;
	g_packetLenMap[483] = 14;
	g_packetLenMap[484] = 2;
	g_packetLenMap[485] = 6;
	g_packetLenMap[486] = 26;
	g_packetLenMap[487] = 2;
	g_packetLenMap[488] = 28;
	g_packetLenMap[489] = 81;
	g_packetLenMap[490] = 6;
	g_packetLenMap[491] = 10;
	g_packetLenMap[492] = 26;
	g_packetLenMap[493] = 2;
	g_packetLenMap[494] = -1;
	g_packetLenMap[495] = -1;
	g_packetLenMap[496] = -1;
	g_packetLenMap[497] = -1;
	g_packetLenMap[498] = 20;
	g_packetLenMap[499] = 10;
	g_packetLenMap[500] = 32;
	g_packetLenMap[501] = 9;
	g_packetLenMap[502] = 34;
	g_packetLenMap[503] = 14;
	g_packetLenMap[504] = 2;
	g_packetLenMap[505] = 6;
	g_packetLenMap[506] = 48;
	g_packetLenMap[507] = 56;
	g_packetLenMap[508] = -1;
	g_packetLenMap[509] = 15;
	g_packetLenMap[510] = 5;
	g_packetLenMap[511] = 10;
	g_packetLenMap[512] = 26;
	g_packetLenMap[513] = -1;
	g_packetLenMap[514] = 26;
	g_packetLenMap[515] = 10;
	g_packetLenMap[516] = 18;
	g_packetLenMap[517] = 26;
	g_packetLenMap[518] = 11;
	g_packetLenMap[519] = 34;
	g_packetLenMap[520] = 14;
	g_packetLenMap[521] = 36;
	g_packetLenMap[522] = 10;
//	REGN(523, 19, HEADER_CH_EXE_HASHCHECK, PACKET_CH_EXE_HASHCHECK);
//	REGN(524, 19, HEADER_CZ_EXE_HASHCHECK, PACKET_CZ_EXE_HASHCHECK);
	g_packetLenMap[525] = -1;
	g_packetLenMap[526] = 32;
	g_packetLenMap[527] = 10;
	g_packetLenMap[528] = 22;
//	REGN(529, 6, HEADER_ZH_MOVE_PVPWORLD, PACKET_ZH_MOVE_PVPWORLD);
	g_packetLenMap[530] = 26;
	g_packetLenMap[531] = 26;
	g_packetLenMap[532] = 42;
	g_packetLenMap[533] = 6;
	g_packetLenMap[534] = 6;
	g_packetLenMap[535] = 2;
	g_packetLenMap[536] = 2;
	g_packetLenMap[537] = 282;
	g_packetLenMap[538] = 282;
	g_packetLenMap[539] = 10;
	g_packetLenMap[540] = 10;
	g_packetLenMap[541] = 6;
	g_packetLenMap[542] = 6;
	g_packetLenMap[543] = 66;
	g_packetLenMap[544] = 10;
	g_packetLenMap[545] = -1;
	g_packetLenMap[546] = 6;
	g_packetLenMap[547] = 8;
	g_packetLenMap[548] = 10;
	g_packetLenMap[549] = 2;
	g_packetLenMap[550] = 282;
	g_packetLenMap[551] = 18;
	g_packetLenMap[552] = 18;
	g_packetLenMap[553] = 15;
	g_packetLenMap[554] = 58;
	g_packetLenMap[555] = 57;
	g_packetLenMap[556] = 65;
	g_packetLenMap[557] = 5;
	g_packetLenMap[558] = 71;
	g_packetLenMap[559] = 5;
	g_packetLenMap[560] = 12;
	g_packetLenMap[561] = 26;
	g_packetLenMap[562] = 9;
	g_packetLenMap[563] = 11;
	g_packetLenMap[564] = 6;
	g_packetLenMap[565] = -1;
	g_packetLenMap[566] = 10;
	g_packetLenMap[567] = 2;
	g_packetLenMap[568] = 282;
	g_packetLenMap[569] = 11;
	g_packetLenMap[570] = 4;
	g_packetLenMap[571] = 36;
	g_packetLenMap[572] = 6;
	g_packetLenMap[573] = 6;
	g_packetLenMap[574] = 8;
	g_packetLenMap[575] = 2;
	g_packetLenMap[576] = -1;
	g_packetLenMap[577] = 6;
	g_packetLenMap[578] = -1;
	g_packetLenMap[579] = 6;
	g_packetLenMap[580] = 6;
	g_packetLenMap[581] = 3;
	g_packetLenMap[582] = 4;
	g_packetLenMap[583] = 8;
	g_packetLenMap[584] = -1;
	g_packetLenMap[585] = 3;
	g_packetLenMap[586] = 70;
	g_packetLenMap[587] = 4;
	g_packetLenMap[588] = 8;
	g_packetLenMap[589] = 12;
	g_packetLenMap[590] = 6;
	g_packetLenMap[591] = 10;
	g_packetLenMap[592] = 3;
	g_packetLenMap[593] = 34;
	g_packetLenMap[594] = -1;
	g_packetLenMap[595] = 3;
	g_packetLenMap[596] = 3;
	g_packetLenMap[597] = 5;
	g_packetLenMap[598] = 5;
	g_packetLenMap[599] = 8;
	g_packetLenMap[600] = 2;
	g_packetLenMap[601] = 3;
	g_packetLenMap[602] = -1;
	g_packetLenMap[603] = 6;
	g_packetLenMap[604] = 4;
	g_packetLenMap[605] = 6;
	g_packetLenMap[606] = 4;
	g_packetLenMap[607] = 6;
	g_packetLenMap[608] = 6;
	g_packetLenMap[609] = 11;
	g_packetLenMap[610] = 11;
	g_packetLenMap[611] = 11;
	g_packetLenMap[612] = 20;
	g_packetLenMap[613] = 20;
	g_packetLenMap[614] = 30;
	g_packetLenMap[615] = 4;
	g_packetLenMap[616] = 4;
	g_packetLenMap[617] = 4;
	g_packetLenMap[618] = 4;
	g_packetLenMap[619] = 4;
	g_packetLenMap[620] = 4;
	g_packetLenMap[621] = 4;
//	REGN(622, 4, HEADER_AC_ACK_AUTHEKEY_FAIL_NOTMATCHCARDPASS, PACKET_CA_PT_EKEY_FAIL);
	g_packetLenMap[623] = 2;
	g_packetLenMap[624] = 2;
	g_packetLenMap[625] = 40;
	g_packetLenMap[626] = 44;
	g_packetLenMap[627] = 30;
	g_packetLenMap[628] = 8;
	g_packetLenMap[629] = 37;
	g_packetLenMap[630] = -1;
	g_packetLenMap[631] = 84;
	g_packetLenMap[632] = 2;
	g_packetLenMap[633] = 2;
	g_packetLenMap[634] = -1;
	g_packetLenMap[635] = 14;
	g_packetLenMap[636] = 60;
	g_packetLenMap[637] = 62;
	g_packetLenMap[638] = -1;
	g_packetLenMap[639] = 8;
	g_packetLenMap[640] = 12;
	g_packetLenMap[641] = 4;
	g_packetLenMap[642] = 284;
	g_packetLenMap[643] = 6;
	g_packetLenMap[644] = 14;
	g_packetLenMap[645] = 6;
	g_packetLenMap[646] = 4;
	g_packetLenMap[647] = -1;
	g_packetLenMap[648] = 10;
	g_packetLenMap[649] = 12;
	g_packetLenMap[650] = 18;
	g_packetLenMap[651] = -1;
	g_packetLenMap[652] = 46;
	g_packetLenMap[653] = 34;
	g_packetLenMap[654] = 4;
	g_packetLenMap[655] = 6;
	g_packetLenMap[656] = 4;
	g_packetLenMap[657] = 4;
	g_packetLenMap[658] = 2;
	g_packetLenMap[659] = 70;
	g_packetLenMap[660] = 10;
	g_packetLenMap[661] = -1;
	g_packetLenMap[662] = -1;
	g_packetLenMap[663] = -1;
	g_packetLenMap[664] = 8;
	g_packetLenMap[665] = 6;
	g_packetLenMap[666] = 27;
	g_packetLenMap[667] = 80;
	g_packetLenMap[668] = 66;
	g_packetLenMap[669] = -1;
	g_packetLenMap[670] = 11;
	g_packetLenMap[671] = 3;
//	REG?(672, ?, UNUSED_HEADER_CZ_MER_USE_SKILL, ?);
//	REG?(673, ?, UNUSED_HEADER_CZ_MER_USE_SKILL, ?);
	g_packetLenMap[674] = 8;
//	REG?(675, ?, HEADER_ZC_GAMEGUARD_LINGO_KEY, ?);
//	REG?(676, ?, HEADER_CZ_GAMEGUARD_LINGO_READY, ?);
	g_packetLenMap[677] = 8;
//	REGN(678, ?, HEADER_ZC_HACKSH_CPX_MSG, ?);
//	REGN(679, ?, HEADER_CZ_HACKSH_CPX_MSG, ?);
//	REG?(680, ?, HEADER_ZC_HACKSHIELD_CRC_MSG, ?);
//	REG?(681, ?, HEADER_CZ_HACKSHIELD_CRC_MSG, ?);
	g_packetLenMap[682] = 4;
	g_packetLenMap[683] = 36;
	g_packetLenMap[684] = 6;
	g_packetLenMap[685] = 8;
//	REG?(686, ?, HEADER_ZC_SRPACKET_INIT, ?);
//	REG?(687, ?, HEADER_CZ_SRPACKET_START, ?);
	g_packetLenMap[688] = 85;
	g_packetLenMap[689] = -1;
	g_packetLenMap[690] = -1;
	g_packetLenMap[691] = 107;
	g_packetLenMap[692] = 6;
	g_packetLenMap[693] = -1;
	g_packetLenMap[694] = 7;
	g_packetLenMap[695] = 7;
	g_packetLenMap[696] = 22;
	g_packetLenMap[697] = 191;
	g_packetLenMap[698] = 11;
	g_packetLenMap[699] = 8;
	g_packetLenMap[700] = 6;
//	REG?(701, ?, HEADER_ZC_SRCRYPTOR2_INIT, ?);
//	REG?(702, ?, HEADER_CZ_SRCRYPTOR2_START, ?);
//	REG?(703, ?, HEADER_ZC_SRPACKETR2_INIT, ?);
//	REG?(704, ?, HEADER_CZ_SRPACKETR2_START, ?);
	g_packetLenMap[705] = -1;
	g_packetLenMap[706] = -1;
//	REG?(707, ?, UNUSED_HEADER_CZ_FORMATSTRING_MSG_RES, ?);
	g_packetLenMap[708] = 26;
	g_packetLenMap[709] = 30;
	g_packetLenMap[710] = 30;
	g_packetLenMap[711] = 7;
	g_packetLenMap[712] = 3;
	g_packetLenMap[713] = 3;
	g_packetLenMap[714] = 3;
	g_packetLenMap[715] = 65;
	g_packetLenMap[716] = 4;
	g_packetLenMap[717] = 71;
	g_packetLenMap[718] = 10;
	g_packetLenMap[719] = 6;
	g_packetLenMap[720] = -1;
	g_packetLenMap[721] = -1;
	g_packetLenMap[722] = -1;
	g_packetLenMap[723] = 4;
	g_packetLenMap[724] = 29;
	g_packetLenMap[725] = 2;
	g_packetLenMap[726] = 6;
	g_packetLenMap[727] = -1;
	g_packetLenMap[728] = 10;
	g_packetLenMap[729] = 10;
	g_packetLenMap[730] = 3;
	g_packetLenMap[731] = -1;
	g_packetLenMap[732] = -1;
	g_packetLenMap[733] = 32;
	g_packetLenMap[734] = 6;
	g_packetLenMap[735] = 36;
	g_packetLenMap[736] = 34;
	REGN(737, 33, HEADER_ZC_NOTIFY_ACT2, PACKET_ZC_NOTIFY_ACT2);
	g_packetLenMap[738] = 20;
	g_packetLenMap[739] = 22;
	g_packetLenMap[740] = 11;
	g_packetLenMap[741] = 9;
	g_packetLenMap[742] = 6;
	g_packetLenMap[743] = -1;
	g_packetLenMap[744] = -1;
	g_packetLenMap[745] = -1;
	g_packetLenMap[746] = -1;
	g_packetLenMap[747] = 13;
	g_packetLenMap[748] = 67;
	g_packetLenMap[749] = 59;
	g_packetLenMap[750] = 60;
	g_packetLenMap[751] = 8;
	g_packetLenMap[752] = 10;
	g_packetLenMap[753] = 2;
	g_packetLenMap[754] = 2;
	REGV(755, 19, HEADER_ZC_ITEM_FALL_ENTRY2, PACKET_ZC_ITEM_FALL_ENTRY2);
	REGV(756, 19, HEADER_ZC_ITEM_FALL_ENTRY2__M1, PACKET_ZC_ITEM_FALL_ENTRY2);
	REGV(757, 19, HEADER_ZC_ITEM_FALL_ENTRY2__M2, PACKET_ZC_ITEM_FALL_ENTRY2);
	REGV(758, 19, HEADER_ZC_ITEM_FALL_ENTRY2__M3, PACKET_ZC_ITEM_FALL_ENTRY2);
	REGV(759, 19, HEADER_ZC_ITEM_FALL_ENTRY2__M4, PACKET_ZC_ITEM_FALL_ENTRY2);
	REGV(760, 19, HEADER_ZC_ITEM_FALL_ENTRY2__M5, PACKET_ZC_ITEM_FALL_ENTRY2);
	REGV(761, 19, HEADER_ZC_ITEM_FALL_ENTRY2__M6, PACKET_ZC_ITEM_FALL_ENTRY2);
	g_packetLenMap[762] = -1;
	g_packetLenMap[763] = -1;
	g_packetLenMap[764] = -1;
	g_packetLenMap[765] = -1;
	g_packetLenMap[766] = -1;
	g_packetLenMap[767] = -1;
	g_packetLenMap[768] = -1;
	g_packetLenMap[769] = -1;
	g_packetLenMap[770] = -1;
	g_packetLenMap[771] = -1;
	g_packetLenMap[772] = -1;
	g_packetLenMap[773] = -1;
	g_packetLenMap[774] = -1;
	g_packetLenMap[775] = -1;
	REGV(776, 4, HEADER_ZC_REASSEMBLY_CERTIFY, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(777, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M01, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(778, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M02, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(779, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M03, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(780, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M04, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(781, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M05, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(782, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M06, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(783, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M07, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(784, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M08, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(785, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M09, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(786, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M10, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(787, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M11, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(788, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M12, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(789, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M13, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(790, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M14, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(791, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M15, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(792, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M16, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(793, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M17, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(794, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M18, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(795, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M19, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(796, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M20, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(797, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M21, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(798, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M22, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(799, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M23, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(800, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M24, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(801, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M25, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(802, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M26, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(803, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M27, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(804, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M28, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(805, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M29, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(806, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M30, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(807, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M31, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(808, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M32, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(809, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M33, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(810, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M34, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(811, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M35, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(812, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M36, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(813, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M37, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(814, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M38, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(815, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M39, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(816, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M40, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(817, 4, HEADER_ZC_REASSEMBLY_CERTIFY__M41, PACKET_ZC_REASSEMBLY_CERTIFY);
	REGV(818, 5, HEADER_CZ_REASSEMBLY_IDENTITY, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(819, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M01, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(820, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M02, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(821, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M03, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(822, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M04, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(823, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M05, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(824, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M06, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(825, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M07, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(826, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M08, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(827, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M09, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(828, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M10, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(829, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M11, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(830, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M12, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(831, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M13, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(832, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M14, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(833, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M15, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(834, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M16, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(835, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M17, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(836, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M18, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(837, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M19, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(838, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M20, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(839, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M21, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(840, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M22, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(841, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M23, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(842, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M24, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(843, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M25, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(844, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M26, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(845, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M27, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(846, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M28, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(847, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M29, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(848, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M30, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(849, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M31, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(850, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M32, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(851, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M33, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(852, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M34, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(853, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M35, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(854, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M36, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(855, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M37, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(856, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M38, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(857, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M39, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(858, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M40, PACKET_CZ_REASSEMBLY_IDENTITY);
	REGV(859, 5, HEADER_CZ_REASSEMBLY_IDENTITY__M41, PACKET_CZ_REASSEMBLY_IDENTITY);
	g_packetLenMap[860] = 2;
	g_packetLenMap[861] = -1;
	g_packetLenMap[862] = 2;
	g_packetLenMap[863] = -1;
	g_packetLenMap[864] = -1;
	g_packetLenMap[865] = -1;
	g_packetLenMap[866] = -1;
	g_packetLenMap[867] = -1;
	g_packetLenMap[868] = -1;
	g_packetLenMap[869] = -1;
	g_packetLenMap[870] = -1;
	g_packetLenMap[871] = -1;
	g_packetLenMap[872] = -1;
	g_packetLenMap[873] = -1;
	g_packetLenMap[874] = -1;
	g_packetLenMap[875] = -1;
	g_packetLenMap[876] = -1;
	g_packetLenMap[877] = -1;
	g_packetLenMap[878] = -1;
	g_packetLenMap[879] = -1;
	g_packetLenMap[880] = -1;
	g_packetLenMap[881] = -1;
	g_packetLenMap[882] = -1;
	g_packetLenMap[883] = -1;
	g_packetLenMap[884] = -1;
	g_packetLenMap[885] = -1;
	g_packetLenMap[886] = -1;
	g_packetLenMap[887] = -1;
	g_packetLenMap[888] = -1;
	g_packetLenMap[889] = -1;
	g_packetLenMap[890] = -1;
	g_packetLenMap[891] = -1;
	g_packetLenMap[892] = -1;
	g_packetLenMap[893] = -1;
	g_packetLenMap[894] = -1;
	g_packetLenMap[895] = -1;
	g_packetLenMap[896] = -1;
	g_packetLenMap[897] = -1;
	g_packetLenMap[898] = -1;
	g_packetLenMap[899] = -1;
	g_packetLenMap[900] = -1;
	g_packetLenMap[901] = -1;
	g_packetLenMap[902] = -1;
	g_packetLenMap[903] = -1;
	g_packetLenMap[904] = -1;
	g_packetLenMap[905] = -1;
	g_packetLenMap[906] = -1;
	g_packetLenMap[907] = -1;
	g_packetLenMap[908] = -1;
	g_packetLenMap[909] = -1;
	g_packetLenMap[910] = -1;
	g_packetLenMap[911] = -1;
	g_packetLenMap[912] = -1;
	g_packetLenMap[913] = -1;
	g_packetLenMap[914] = -1;
	g_packetLenMap[915] = -1;
	g_packetLenMap[916] = -1;
	g_packetLenMap[917] = -1;
	g_packetLenMap[918] = -1;
	g_packetLenMap[919] = -1;
	g_packetLenMap[920] = -1;
	g_packetLenMap[921] = -1;
	g_packetLenMap[922] = -1;
	g_packetLenMap[923] = -1;
	g_packetLenMap[924] = -1;
	g_packetLenMap[925] = -1;
	g_packetLenMap[926] = -1;
	g_packetLenMap[927] = -1;
	g_packetLenMap[928] = -1;
	g_packetLenMap[929] = -1;
	g_packetLenMap[930] = -1;
	g_packetLenMap[931] = -1;
	g_packetLenMap[932] = -1;
	g_packetLenMap[933] = -1;
	g_packetLenMap[934] = -1;
	g_packetLenMap[935] = -1;
	g_packetLenMap[936] = -1;
	g_packetLenMap[937] = -1;
	g_packetLenMap[938] = -1;
	g_packetLenMap[939] = -1;
	g_packetLenMap[940] = -1;
	g_packetLenMap[941] = -1;
	g_packetLenMap[942] = -1;
	g_packetLenMap[943] = -1;
	g_packetLenMap[944] = -1;
	g_packetLenMap[945] = -1;
	g_packetLenMap[946] = -1;
	g_packetLenMap[947] = -1;
	g_packetLenMap[948] = -1;
	g_packetLenMap[949] = -1;
	g_packetLenMap[950] = -1;
	g_packetLenMap[951] = -1;
	g_packetLenMap[952] = -1;
	g_packetLenMap[953] = -1;
	g_packetLenMap[954] = -1;
	g_packetLenMap[955] = -1;
	g_packetLenMap[956] = -1;
	g_packetLenMap[957] = -1;
	g_packetLenMap[958] = -1;
	g_packetLenMap[959] = -1;
	g_packetLenMap[960] = -1;
	g_packetLenMap[961] = -1;
	g_packetLenMap[962] = -1;
	g_packetLenMap[963] = -1;
	g_packetLenMap[964] = -1;
	g_packetLenMap[965] = -1;
	g_packetLenMap[966] = -1;
	g_packetLenMap[967] = -1;
	g_packetLenMap[968] = -1;
	g_packetLenMap[969] = -1;
	g_packetLenMap[970] = -1;
	g_packetLenMap[971] = -1;
	g_packetLenMap[972] = -1;
	g_packetLenMap[973] = -1;
	g_packetLenMap[974] = -1;
	g_packetLenMap[975] = -1;
	g_packetLenMap[976] = -1;
	g_packetLenMap[977] = -1;
	g_packetLenMap[978] = -1;
	g_packetLenMap[979] = -1;
	g_packetLenMap[980] = -1;
	g_packetLenMap[981] = -1;
	g_packetLenMap[982] = -1;
	g_packetLenMap[983] = -1;
	g_packetLenMap[984] = -1;
	g_packetLenMap[985] = -1;
	g_packetLenMap[986] = -1;
	g_packetLenMap[987] = -1;
	g_packetLenMap[988] = -1;
	g_packetLenMap[989] = 18;
	g_packetLenMap[990] = 18;
//	REG?(991, ?, HEADER_ZC_WAITINGROOM_PARTYPLAY_JOIN, ?);
//	REG?(992, ?, HEADER_CZ_WAITINGROOM_PARTYPLAY_JOIN_RESULT, ?);
//	REG?(993, ?, HEADER_ZC_WAITINGROOM_SUBSCRIPTION_RESULT, ?);
	REGV(994, 35, HEADER_ZC_NOTIFY_ACT3, PACKET_ZC_NOTIFY_ACT3);
	REGV(995, 35, HEADER_ZC_NOTIFY_ACT3__M01, PACKET_ZC_NOTIFY_ACT3);
	REGV(996, 35, HEADER_ZC_NOTIFY_ACT3__M02, PACKET_ZC_NOTIFY_ACT3);
	REGV(997, 35, HEADER_ZC_NOTIFY_ACT3__M03, PACKET_ZC_NOTIFY_ACT3);
	REGV(998, 35, HEADER_ZC_NOTIFY_ACT3__M04, PACKET_ZC_NOTIFY_ACT3);
	REGV(999, 35, HEADER_ZC_NOTIFY_ACT3__M05, PACKET_ZC_NOTIFY_ACT3);
	REGV(1000, 35, HEADER_ZC_NOTIFY_ACT3__M06, PACKET_ZC_NOTIFY_ACT3);
	REGV(1001, 35, HEADER_ZC_NOTIFY_ACT3__M07, PACKET_ZC_NOTIFY_ACT3);
	REGV(1002, 35, HEADER_ZC_NOTIFY_ACT3__M08, PACKET_ZC_NOTIFY_ACT3);
	REGV(1003, 35, HEADER_ZC_NOTIFY_ACT3__M09, PACKET_ZC_NOTIFY_ACT3);
	REGV(1004, 35, HEADER_ZC_NOTIFY_ACT3__M10, PACKET_ZC_NOTIFY_ACT3);
	REGV(1005, 35, HEADER_ZC_NOTIFY_ACT3__M11, PACKET_ZC_NOTIFY_ACT3);
	REGV(1006, 35, HEADER_ZC_NOTIFY_ACT3__M12, PACKET_ZC_NOTIFY_ACT3);
	REGV(1007, 35, HEADER_ZC_NOTIFY_ACT3__M13, PACKET_ZC_NOTIFY_ACT3);
	REGV(1008, 35, HEADER_ZC_NOTIFY_ACT3__M14, PACKET_ZC_NOTIFY_ACT3);
	REGV(1009, 35, HEADER_ZC_NOTIFY_ACT3__M15, PACKET_ZC_NOTIFY_ACT3);
	REGV(1010, 35, HEADER_ZC_NOTIFY_ACT3__M16, PACKET_ZC_NOTIFY_ACT3);
	REGV(1011, 35, HEADER_ZC_NOTIFY_ACT3__M17, PACKET_ZC_NOTIFY_ACT3);
	REGV(1012, 35, HEADER_ZC_NOTIFY_ACT3__M18, PACKET_ZC_NOTIFY_ACT3);
	REGV(1013, 35, HEADER_ZC_NOTIFY_ACT3__M19, PACKET_ZC_NOTIFY_ACT3);
	REGV(1014, 35, HEADER_ZC_NOTIFY_ACT3__M20, PACKET_ZC_NOTIFY_ACT3);
	REGV(1015, 35, HEADER_ZC_NOTIFY_ACT3__M21, PACKET_ZC_NOTIFY_ACT3);
	REGV(1016, 35, HEADER_ZC_NOTIFY_ACT3__M22, PACKET_ZC_NOTIFY_ACT3);
	REGV(1017, 35, HEADER_ZC_NOTIFY_ACT3__M23, PACKET_ZC_NOTIFY_ACT3);
	REGV(1018, 35, HEADER_ZC_NOTIFY_ACT3__M24, PACKET_ZC_NOTIFY_ACT3);
	REGV(1019, 35, HEADER_ZC_NOTIFY_ACT3__M25, PACKET_ZC_NOTIFY_ACT3);
	REGV(1020, 35, HEADER_ZC_NOTIFY_ACT3__M26, PACKET_ZC_NOTIFY_ACT3);
	REGV(1021, 35, HEADER_ZC_NOTIFY_ACT3__M27, PACKET_ZC_NOTIFY_ACT3);
	REGV(1022, 35, HEADER_ZC_NOTIFY_ACT3__M28, PACKET_ZC_NOTIFY_ACT3);
	REGV(1023, 35, HEADER_ZC_NOTIFY_ACT3__M29, PACKET_ZC_NOTIFY_ACT3);
	REGV(1024, 35, HEADER_ZC_NOTIFY_ACT3__M30, PACKET_ZC_NOTIFY_ACT3);
	REGV(1025, 35, HEADER_ZC_NOTIFY_ACT3__M31, PACKET_ZC_NOTIFY_ACT3);
	REGV(1026, 35, HEADER_ZC_NOTIFY_ACT3__M32, PACKET_ZC_NOTIFY_ACT3);
	REGV(1027, 35, HEADER_ZC_NOTIFY_ACT3__M33, PACKET_ZC_NOTIFY_ACT3);
	REGV(1028, 35, HEADER_ZC_NOTIFY_ACT3__M34, PACKET_ZC_NOTIFY_ACT3);
	REGV(1029, 35, HEADER_ZC_NOTIFY_ACT3__M35, PACKET_ZC_NOTIFY_ACT3);
	REGV(1030, 35, HEADER_ZC_NOTIFY_ACT3__M36, PACKET_ZC_NOTIFY_ACT3);
	REGV(1031, 35, HEADER_ZC_NOTIFY_ACT3__M37, PACKET_ZC_NOTIFY_ACT3);
	REGV(1032, 35, HEADER_ZC_NOTIFY_ACT3__M38, PACKET_ZC_NOTIFY_ACT3);
	REGV(1033, 35, HEADER_ZC_NOTIFY_ACT3__M39, PACKET_ZC_NOTIFY_ACT3);
	REGV(1034, 35, HEADER_ZC_NOTIFY_ACT3__M40, PACKET_ZC_NOTIFY_ACT3);
	REGV(1035, 35, HEADER_ZC_NOTIFY_ACT3__M41, PACKET_ZC_NOTIFY_ACT3);
	REGV(1036, 16, HEADER_ZC_BROADCAST3, PACKET_ZC_BROADCAST3);
	REGV(1037, 16, HEADER_ZC_BROADCAST3__M01, PACKET_ZC_BROADCAST3);
	REGV(1038, 16, HEADER_ZC_BROADCAST3__M02, PACKET_ZC_BROADCAST3);
	REGV(1039, 16, HEADER_ZC_BROADCAST3__M03, PACKET_ZC_BROADCAST3);
	REGV(1040, 16, HEADER_ZC_BROADCAST3__M04, PACKET_ZC_BROADCAST3);
	REGV(1041, 16, HEADER_ZC_BROADCAST3__M05, PACKET_ZC_BROADCAST3);
	REGV(1042, 16, HEADER_ZC_BROADCAST3__M06, PACKET_ZC_BROADCAST3);
	REGV(1043, 16, HEADER_ZC_BROADCAST3__M07, PACKET_ZC_BROADCAST3);
	REGV(1044, 16, HEADER_ZC_BROADCAST3__M08, PACKET_ZC_BROADCAST3);
	REGV(1045, 16, HEADER_ZC_BROADCAST3__M09, PACKET_ZC_BROADCAST3);
	REGV(1046, 16, HEADER_ZC_BROADCAST3__M10, PACKET_ZC_BROADCAST3);
	REGV(1047, 16, HEADER_ZC_BROADCAST3__M11, PACKET_ZC_BROADCAST3);
	REGV(1048, 16, HEADER_ZC_BROADCAST3__M12, PACKET_ZC_BROADCAST3);
	REGV(1049, 16, HEADER_ZC_BROADCAST3__M13, PACKET_ZC_BROADCAST3);
	REGV(1050, 16, HEADER_ZC_BROADCAST3__M14, PACKET_ZC_BROADCAST3);
	REGV(1051, 16, HEADER_ZC_BROADCAST3__M15, PACKET_ZC_BROADCAST3);
	REGV(1052, 16, HEADER_ZC_BROADCAST3__M16, PACKET_ZC_BROADCAST3);
	REGV(1053, 16, HEADER_ZC_BROADCAST3__M17, PACKET_ZC_BROADCAST3);
	REGV(1054, 16, HEADER_ZC_BROADCAST3__M18, PACKET_ZC_BROADCAST3);
	REGV(1055, 16, HEADER_ZC_BROADCAST3__M19, PACKET_ZC_BROADCAST3);
	REGV(1056, 16, HEADER_ZC_BROADCAST3__M20, PACKET_ZC_BROADCAST3);
	REGV(1057, 16, HEADER_ZC_BROADCAST3__M21, PACKET_ZC_BROADCAST3);
	REGV(1058, 16, HEADER_ZC_BROADCAST3__M22, PACKET_ZC_BROADCAST3);
	REGV(1059, 16, HEADER_ZC_BROADCAST3__M23, PACKET_ZC_BROADCAST3);
	REGV(1060, 16, HEADER_ZC_BROADCAST3__M24, PACKET_ZC_BROADCAST3);
	REGV(1061, 16, HEADER_ZC_BROADCAST3__M25, PACKET_ZC_BROADCAST3);
	REGV(1062, 16, HEADER_ZC_BROADCAST3__M26, PACKET_ZC_BROADCAST3);
	REGV(1063, 16, HEADER_ZC_BROADCAST3__M27, PACKET_ZC_BROADCAST3);
	REGV(1064, 16, HEADER_ZC_BROADCAST3__M28, PACKET_ZC_BROADCAST3);
	REGV(1065, 16, HEADER_ZC_BROADCAST3__M29, PACKET_ZC_BROADCAST3);
	REGV(1066, 16, HEADER_ZC_BROADCAST3__M30, PACKET_ZC_BROADCAST3);
	REGV(1067, 16, HEADER_ZC_BROADCAST3__M31, PACKET_ZC_BROADCAST3);
	REGV(1068, 16, HEADER_ZC_BROADCAST3__M32, PACKET_ZC_BROADCAST3);
	REGV(1069, 16, HEADER_ZC_BROADCAST3__M33, PACKET_ZC_BROADCAST3);
	REGV(1070, 16, HEADER_ZC_BROADCAST3__M34, PACKET_ZC_BROADCAST3);
	REGV(1071, 16, HEADER_ZC_BROADCAST3__M35, PACKET_ZC_BROADCAST3);
	REGV(1072, 16, HEADER_ZC_BROADCAST3__M36, PACKET_ZC_BROADCAST3);
	REGV(1073, 16, HEADER_ZC_BROADCAST3__M37, PACKET_ZC_BROADCAST3);
	REGV(1074, 16, HEADER_ZC_BROADCAST3__M38, PACKET_ZC_BROADCAST3);
	REGV(1075, 16, HEADER_ZC_BROADCAST3__M39, PACKET_ZC_BROADCAST3);
	REGV(1076, 16, HEADER_ZC_BROADCAST3__M40, PACKET_ZC_BROADCAST3);
	REGV(1077, 16, HEADER_ZC_BROADCAST3__M41, PACKET_ZC_BROADCAST3);
	g_packetLenMap[1078] = 19;
	g_packetLenMap[1079] = 7;
	g_packetLenMap[1080] = 10;
	g_packetLenMap[1081] = 8;
//	REG?(1082, ?, HEADER_ZC_REQ_CRACKPROOF, ?);
//	REG?(1083, ?, HEADER_CZ_ACK_CRACKPROOF, ?);
//	REG?(1084, ?, HEADER_ZC_CRACKPROOF_ERRCODE, ?);
	g_packetLenMap[1085] = 8;
	g_packetLenMap[1086] = -1;
	g_packetLenMap[1087] = 25;
	g_packetLenMap[1088] = 10;
	g_packetLenMap[1089] = 4;
	REGV(1090, 8, HEADER_ZC_SKILL_SELECT_REQUEST, PACKET_ZC_SKILL_SELECT_REQUEST);
	g_packetLenMap[1091] = 8;
	g_packetLenMap[1092] = -1;
	g_packetLenMap[1093] = 10;
	g_packetLenMap[1094] = 14;
	g_packetLenMap[1095] = 2;
	g_packetLenMap[1096] = -1;
//	REG?(1097, 4, HEADER_ZC_HACKSH_ERROR_MSG, ?);
	g_packetLenMap[1098] = 6;
	g_packetLenMap[1099] = 2;
	g_packetLenMap[2000] = 6;
	g_packetLenMap[2001] = 2;
	g_packetLenMap[2002] = -1;
	g_packetLenMap[2003] = 4;
	g_packetLenMap[2004] = 4;
	g_packetLenMap[2005] = 4;
	g_packetLenMap[2006] = 4;
	g_packetLenMap[2007] = 8;
	g_packetLenMap[2008] = 8;
	g_packetLenMap[2009] = 268;
	g_packetLenMap[2010] = 6;
	g_packetLenMap[2011] = 8;
	g_packetLenMap[2012] = 6;
	g_packetLenMap[2013] = 54;
	g_packetLenMap[2014] = 30;
	g_packetLenMap[2015] = 54;
	g_packetLenMap[2016] = 58;
	g_packetLenMap[2017] = 15;
	g_packetLenMap[2018] = 8;
	g_packetLenMap[2019] = 6;
	g_packetLenMap[2020] = -1;
	g_packetLenMap[2021] = 8;
	g_packetLenMap[2022] = 8;
	g_packetLenMap[2023] = 32;
	g_packetLenMap[2024] = -1;
	g_packetLenMap[2025] = 5;
	g_packetLenMap[2026] = 2;
	g_packetLenMap[2027] = -1;
	g_packetLenMap[2028] = 8;
	g_packetLenMap[2029] = 10;
	g_packetLenMap[2030] = 6;
	g_packetLenMap[2031] = 8;
	g_packetLenMap[2032] = 6;
	g_packetLenMap[2033] = 15;
	g_packetLenMap[2034] = 6;
	g_packetLenMap[2035] = 4;
	g_packetLenMap[2036] = 3;
	g_packetLenMap[2037] = 6;
	g_packetLenMap[2038] = 14;
	g_packetLenMap[2039] = -1;
	g_packetLenMap[2040] = -1;
	g_packetLenMap[2041] = -1;
	g_packetLenMap[2042] = 8;
	g_packetLenMap[2043] = 25;
	g_packetLenMap[2044] = 10;
	g_packetLenMap[2045] = -1;
	g_packetLenMap[2046] = 26;
	g_packetLenMap[2047] = -1;
	g_packetLenMap[2048] = -1;
	g_packetLenMap[2049] = -1;
	g_packetLenMap[2050] = 18;
	g_packetLenMap[2051] = 4;
	g_packetLenMap[2052] = 14;
	g_packetLenMap[2053] = -1;
	g_packetLenMap[2054] = 2;
	g_packetLenMap[2055] = 4;
	g_packetLenMap[2056] = 14;
	g_packetLenMap[2057] = 50;
	g_packetLenMap[2058] = 18;
	g_packetLenMap[2059] = 6;
	g_packetLenMap[2060] = 2;
	g_packetLenMap[2061] = 3;
	g_packetLenMap[2062] = 14;
	g_packetLenMap[2063] = 20;
	g_packetLenMap[2064] = 3;
	g_packetLenMap[2065] = -1;
	g_packetLenMap[2066] = 8;
	g_packetLenMap[2067] = -1;
	g_packetLenMap[2068] = 86;
	g_packetLenMap[2069] = 2;
	g_packetLenMap[2070] = 6;
	g_packetLenMap[2071] = 6;
	g_packetLenMap[2072] = -1;
	g_packetLenMap[2073] = -1;
	g_packetLenMap[2074] = 4;
	g_packetLenMap[2075] = 10;
	g_packetLenMap[2076] = 10;
	g_packetLenMap[2077] = 22;
	g_packetLenMap[2078] = 8;
	g_packetLenMap[2079] = -1;
	g_packetLenMap[2080] = 11;
	g_packetLenMap[2081] = 2;
	g_packetLenMap[2082] = 9;
	g_packetLenMap[2083] = -1;
	g_packetLenMap[2084] = 6;
	g_packetLenMap[2085] = -1;
	g_packetLenMap[2086] = 4;
	g_packetLenMap[2101] = -1;
	g_packetLenMap[2102] = -1;
	g_packetLenMap[2103] = 3;
	g_packetLenMap[2104] = 2;
	g_packetLenMap[2105] = 66;
	g_packetLenMap[2106] = 4;
	g_packetLenMap[2107] = 2;
	g_packetLenMap[2108] = 12;
	g_packetLenMap[2109] = 6;
	g_packetLenMap[2110] = 26;
	g_packetLenMap[2111] = 22;
}
